package top.coolrainly.module.pb.dal.mysql.organization;

import java.util.*;

import top.coolrainly.framework.common.pojo.PageResult;
import top.coolrainly.framework.mybatis.core.query.LambdaQueryWrapperX;
import top.coolrainly.framework.mybatis.core.mapper.BaseMapperX;
import top.coolrainly.module.pb.dal.dataobject.organization.OrganizationDO;
import org.apache.ibatis.annotations.Mapper;
import top.coolrainly.module.pb.controller.admin.organization.vo.*;

/**
 * 党组织信息 Mapper
 *
 * @author CoolRainLy
 */
@Mapper
public interface OrganizationMapper extends BaseMapperX<OrganizationDO> {

    default PageResult<OrganizationDO> selectPage(OrganizationPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OrganizationDO>()
                .eqIfPresent(OrganizationDO::getParentId, reqVO.getParentId())
                .likeIfPresent(OrganizationDO::getName, reqVO.getName())
                .betweenIfPresent(OrganizationDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OrganizationDO::getId));
    }

}